<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <p>事件冒泡机制</p>
        <ul @click="handleClick2()">
            <li @click="handleClick()">正常冒泡</li>
            <li @click.stop="handleClick()">阻止冒泡</li>
            <li @click.once="handleClick()">自身只触发一次,不阻止冒泡</li>
        </ul>

        <p>事件捕获机制</p>
        <ul @click.captrue="handleClick2()">
            <li @click="handleClick()">正常冒泡</li>
            <li @click.stop="handleClick()">阻止冒泡</li>
            <li @click.once="handleClick()">自身只触发一次,不阻止冒泡</li>
        </ul>
        </ul>

        <p>独立事件机制</p>
        <ul @click.self="handleClick2()">
            <li @click="handleClick()">正常冒泡</li>
            <li @click.stop="handleClick()">阻止冒泡</li>
            <li @click.once="handleClick()">自身只触发一次,不阻止冒泡</li>
        </ul>

        <!-- 阻止标签默认行为 -->
        <button @click.prevent="">Submit</button>
    </div>

    <script>
        let vm = new Vue({
            el: '#app',
            data: {},
            methods: {
                handleClick(){
                    console.log('How are you?')
                },
                handleClick2(){
                    console.log('I am fine.')
                }
            }
        })
    </script>
</body>
</html>